import typescript from "rollup-plugin-ts"
import {lezer} from "@lezer/generator/rollup"

export default {
  input: "src/index.ts",
  external: id => id != "tslib" && !/^(\.?\/|\w:)/.test(id),
  output: [
    {file: "dist/index.cjs", format: "cjs"},
    {dir: "./dist", format: "es"}
  ],
  plugins: [
    lezer({
      // 确保语法文件被正确处理
      grammarFiles: ["src/syntax.grammar", "src/syntax-1.grammar"]
    }), 
    typescript()
  ]
}
